package com.base.controller;

import com.base.service.PorderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/admin")
public class PorderIndexController {

	@Autowired
	private PorderService porderService; // 返佣Service

	// 返佣主页
	@RequestMapping("/porder_index")
	public ModelAndView index(HttpSession session) throws Exception {
		Object obj_id = session.getAttribute("adminUserId"); // 登录的用户ID
		if (obj_id == null) {
			return new ModelAndView("jsp/loginCheck"); // 未登录
		}
		return new ModelAndView("jsp/porder_index", "porder", porderService.select());
	}
}
